import AppLogger, {LoggerLevel} from "../../ark/logger/app-logger";

// 环境变量
const envLoggerLevel = [LoggerLevel.ERROR, LoggerLevel.WARN, LoggerLevel.DEBUG].includes(import.meta.env.VITE_LOGGER_LEVEL)
    ? import.meta.env.VITE_LOGGER_LEVEL
    : LoggerLevel.INFO;

// 日志对象
const logger = new AppLogger(envLoggerLevel)
export {logger as log}

// Vue插件对象，组件内通过this.$log使用
export default {
    install(Vue) {
        Vue.prototype.$log = logger;
    },
};
